﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NF_Tools
{
    public partial class BF_RadioImageButton : RadioButton
    {
        public BF_RadioImageButton()
        {
            InitializeComponent();

            this.Appearance = System.Windows.Forms.Appearance.Button;
            this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.FlatAppearance.MouseDownBackColor = Color.Transparent;
            this.FlatAppearance.MouseOverBackColor = Color.Transparent;
            this.FlatAppearance.BorderSize = 0;
            this.TextAlign = ContentAlignment.BottomCenter;
            this.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
            this.Font = new Font(@"微软雅黑", 11);
            this.ForeColor = Color.FromArgb(90, 90, 90);
            this.Text = "";
        }

        public BF_RadioImageButton(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        [Category("Ternence"), Description("选中图标")]
        public Image CheckImg { get; set; }

        [Category("Ternence"),Description("未选择图标")]
        public Image UnCheckImg { get; set; }



        

        /// <summary>
        /// 重写事件
        /// </summary>
        /// <param name="e"></param>
        protected override void OnCheckedChanged(EventArgs e)
        {
            this.Image = this.Checked ? CheckImg : UnCheckImg;

            base.OnCheckedChanged(e);
        }

    }
}
